<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
	<!--<![endif]-->
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>收款记录</title>
		<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>

		<meta content="telephone=no" name="format-detection" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style" />

		<!-- 引入样式 -->
		<link rel="stylesheet" href="../styles/vant.css">
		<link rel="stylesheet" href="../styles/common.css" />
		<link rel="stylesheet" href="../styles/global.css" />
		<link rel="stylesheet" href="../styles/login.css" />
		<link rel="stylesheet" href="../styles/font.css">
		<!-- 引入组件 -->
		<script src="../scripts/babel.js" type="text/javascript" charset="utf-8"></script>
		<script src="../scripts/rem.js"></script>
		<script src="../scripts/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../scripts/vant.js"></script>
		<script src="../scripts/api.js" type="text/javascript" charset="utf-8"></script>
		<script src="../scripts/axios.js" charset="utf-8"></script>
		<style type="text/css">
			.van-list__finished-text {
				height: 15vh;
			}

			.van-list__loading {
				height: 15vh;
			}
		</style>
	</head>
	<body>
		<!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
		<div class="container" id="app">
			<div class="header">
				<div @click="go_back"><span><i class="iconfont icon-back"></i></span></div>
				<div>收款记录</div>
				<div class="headericon"></div>
			</div>
			<div class="witer" style="height: 0.9rem;">

			</div>
			<div class="container_list">
				<van-list v-model="loading" :finished="finished" :offset="30" finished-text="没有更多了" @load="cys_load">
					<div class="list" v-for="item in list" @click="details(item.cartoonorderid)">						
						<div>
							<p v-text="item.username"></p>
							<p v-text="item.paydate"></p>
						</div>
						<div v-text="item.paymentamt"></div>
					</div>
					
				</van-list>

			</div>

		</div>
	</body>
	<script type="text/babel">
		new Vue({
			el: '#app',
			data: {
				url: "",
				userId: "",
				token: "",
				admin: "",
				data: {
					paymentamt: '',
					count: '',
				},
				list: [],
				loading: false,
				finished: false,
				currypage: 0,
				
			},
			
			mounted: function() {
				this.url = url();
				this.admin = JSON.parse(localStorage.getItem("admin"));
				if (!this.admin) {
					this.$notify("非法登录，请重新登陆");
					setTimeout(this.go_login, 2000);
					return
				}
				this.userId = this.admin.mid;
				this.token = this.admin.token;
			},
			
			methods: {	 
				cys_load() {
					// 异步更新数据
					var that = this;
					that.currypage++
					this.selectMchMoney(this.currypage);
				},
				// 商户收款记录展示/mchapp/info/selectMchOrderList
				selectMchMoney: function(page) {
					var that = this;
					var data = {
						userId: that.userId,
						token: that.token,
						requestString: JSON.stringify({
							mid: that.userId,
							pagesize: 15,
							pagenumber: page
						})
					}
					console.log(data)
					this.loading=true;
					axios.post(that.url + '/mchapp/info/selectMchOrderList', data).then(function(response) {							
							if (response.data.code == 200) {
								that.data = response.data;
								if (response.data.list.length <= 0) {
									that.finished = true;
								} //判断单点登录
								else if(response.data.code == 300){
									that.$notify("账号在别处登录，将为您返回登录页面");//							
									if(that.admin.teltype==1){
										logout_app(that.admin.mid,1)
									}
									if(that.admin.teltype==2){
										logout_app(that.admin.mid,2)
									}
									window.location.href ='../login.html';
								} else {
									that.list = that.list.concat(response.data.list);
								}
								// 加载状态结束
								setTimeout(function(){that.loading = false;},1000);								
							} else if(response.data.code == 300){
								localStorage.removeItem('admin');
								window.location.href = "../login.html"
							}
						})

				},
				details:function(info) {					
					console.log(info);
					window.location.href = 'transaction_details.html'+'?'+info
				},
				go_back: function() {
					window.history.back(-1);
				},
				go_login: function() {
					window.location.href = '../login.html';
				},
			},

		})
	</script>

</html>
